<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
		  google.load("jquery", "1.3.1");
	 google.load("jquery", "1.3.2", {uncompressed:true});
	 google.load("jqueryui", "1.7.0", {uncompressed:true});
</script>
<script type="text/javascript" src="jfeed/build/dist/jquery.jfeed.pack.js"></script>
<script type="text/javascript" src="fancy/jquery.fancybox-1.2.0.js"></script> 
<script type="text/javascript" src="fancy/jquery.easing.1.3.js"></script>
<link rel="stylesheet" href="fancy/jquery.fancybox.css" type="text/css" media="screen">


<script type="text/javascript">

$(document).ready(function (){
     jQuery.getFeed({
        url: 'generatefeed.php',
        success: function(feed) {
            jQuery('#result').append('<h2>'
            + feed.title
            + '</h2>');
            
            var html = '<div id="imagelist">';
            
            for(var i = 0; i < feed.items.length ; i++) {
            
                var item = feed.items[i];
                
                html += '<a href="'
		+ item.link
		+ '"><img src="'
                + item.link
		+ '"></a>';
                          
            }//for
	    html += '</div>';
            
            jQuery('#result').append(html);
	  $('#imagelist').hide();
	    resizeImage();
	    var PP = arrangeInTable($("#imagelist > a"),3,7);
	   $("#result").append(PP);
	    $("a").fancybox();
	    $("#jswall").css("cursor","-moz-grab");
	    $("#jswall").draggable({cursor : '-moz-grabbing'});

        }    
    });
    

});
function resizeImage(){
	
	var AllImg = $("img");
	for(var i=0; i< AllImg.length ; i++){
	  var W = parseInt(AllImg.eq(i).attr("width"));
	  var H = parseInt(AllImg.eq(i).attr("height"));
	  
	   if(W>H){
		AllImg.eq(i).css({width:'100px'});	  
	   }else{
   		AllImg.eq(i).css({height:'100px'});
	   }//if
	
	
	}
	/*		$('img').css({width:'100px',height:'100px'}); */
}//fun
function arrangeInTable(itemArray, row, column){
	var length = itemArray.length;
	var html = '<table id="jswall" border="0px"><tbody>'
	for(var i=0; i<row ; i++){
	html += '<tr>';
	  for(var j=0; j<column ; j++){
		var index = row*j+i;
		if(index < length){
		html += '<td>'
		+ '<a href="'
		+ itemArray.eq(index).attr("href")
		+ '">'
		+ itemArray.eq(index).html()
		+ '</a></td>';
		}else{
		html += '<td/>';
		}
	}
	html += '<tr>';
	}
	
	html += '</tbody></table>'
	return html;

}

</script>
</head>
<body>
<div id="result" />

</body>
</html>
